home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 August / MW 8 2003 CD1.iso / Inside Macworld / Product News / gimp-1.2.4.sit / gimp-1.2.4 / libgimp / gimppatterns_pdb.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-26  |  2.4 KB  |  81 lines

  1. /* LIBGIMP - The GIMP Library
  2.  * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
  3.  *
  4.  * gimppatterns_pdb.c
  5.  *
  6.  * This library is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Lesser General Public
  8.  * License as published by the Free Software Foundation; either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * This library is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  * Lesser General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Lesser General Public
  17.  * License along with this library; if not, write to the
  18.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19.  * Boston, MA 02111-1307, USA.
  20.  */
  21.  
  22. /* NOTE: This file is autogenerated by pdbgen.pl */
  23.  
  24. #include <string.h>
  25.  
  26. #include "gimp.h"
  27.  
  28. /**
  29.  * gimp_patterns_get_pattern_data:
  30.  * @name: the pattern name (\"\" means current active pattern).
  31.  * @width: The pattern width.
  32.  * @height: The pattern height.
  33.  * @mask_bpp: Pattern bytes per pixel.
  34.  * @length: Length of pattern mask data.
  35.  * @mask_data: The pattern mask data.
  36.  *
  37.  * Retrieve information about the currently active pattern (including
  38.  * data).
  39.  *
  40.  * This procedure retrieves information about the currently active
  41.  * pattern. This includes the pattern name, and the pattern extents
  42.  * (width and height). It also returns the pattern data.
  43.  *
  44.  * Returns: The pattern name.
  45.  */
  46. gchar *
  47. gimp_patterns_get_pattern_data (gchar   *name,
  48.                 gint    *width,
  49.                 gint    *height,
  50.                 gint    *mask_bpp,
  51.                 gint    *length,
  52.                 guint8 **mask_data)
  53. {
  54.   GimpParam *return_vals;
  55.   gint nreturn_vals;
  56.   gchar *ret_name = NULL;
  57.  
  58.   return_vals = gimp_run_procedure ("gimp_patterns_get_pattern_data",
  59.                     &nreturn_vals,
  60.                     GIMP_PDB_STRING, name,
  61.                     GIMP_PDB_END);
  62.  
  63.   *length = 0;
  64.  
  65.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  66.     {
  67.       ret_name = g_strdup (return_vals[1].data.d_string);
  68.       *width = return_vals[2].data.d_int32;
  69.       *height = return_vals[3].data.d_int32;
  70.       *mask_bpp = return_vals[4].data.d_int32;
  71.       *length = return_vals[5].data.d_int32;
  72.       *mask_data = g_new (guint8, *length);
  73.       memcpy (*mask_data, return_vals[6].data.d_int8array,
  74.           *length * sizeof (guint8));
  75.     }
  76.  
  77.   gimp_destroy_params (return_vals, nreturn_vals);
  78.  
  79.   return ret_name;
  80. }
  81.